{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8ed0c9c4-3de6-45a4-9ffd-0775a07eeff7",
   "metadata": {},
   "source": [
    "## Pandas:一个数据分析软件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "25231aa7-a2ea-4d1b-a2e4-efe65f869f88",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "704594e9-6dbc-416b-9e1f-d93d1a80f387",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid character '？' (U+FF1F) (2188200539.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[12], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    0.2.1. 为什么使用Pandas？\u001b[0m\n\u001b[1;37m                      ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid character '？' (U+FF1F)\n"
     ]
    }
   ],
   "source": [
    "0.2.1. 为什么使用Pandas？\n",
    "Python 内置数据结构类型以及 Numpy 的数组可用于组织管理数据集，其特点如下：\n",
    "\n",
    "结构\t同质\t可变\t重复\t有序\t映射\n",
    "列表（list）\t否\t是\t是\t是\t否\n",
    "元组（tuple）\t否\t否\t是\t是\t否\n",
    "集合（set）\t否\t是\t否\t否\t否\n",
    "字典（dict）\t否\t是\t是\t否\t是\n",
    "数组（ndarray）\t是\t是\t是\t是\t否\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "dd264e6a-44a7-4915-88c2-ced000ec0d7c",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'times' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[13], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m plt\u001b[38;5;241m.\u001b[39mplot(times, customers)\n",
      "\u001b[1;31mNameError\u001b[0m: name 'times' is not defined"
     ]
    }
   ],
   "source": [
    "plt.plot(times, customers)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "e2022aea-04d4-425a-ad7f-cbacd0346397",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 60,  70,  65, 100, 230, 150, 100, 300, 250, 150])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 时间4点，5点，... 22点:转变为np数组\n",
    "times = np.array([6, 7, 8, 11, 12, 13, 18, 19, 20, 21])\n",
    "# 顾客人数\n",
    "#\n",
    "customers = np.array([60, 70, 65, 100, 230, 150, 100, 300, 250, 150])\n",
    "\n",
    "customers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "91a89779-fed5-408a-8be5-c62a80297464",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     60\n",
       "1     70\n",
       "2     65\n",
       "3    100\n",
       "4    230\n",
       "5    150\n",
       "6    100\n",
       "7    300\n",
       "8    250\n",
       "9    150\n",
       "dtype: int64"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 时间4点，5点，... 22点:转变为np数组\n",
    "times = np.array([6, 7, 8, 11, 12, 13, 18, 19, 20, 21])\n",
    "# 顾客人数\n",
    "customers = pd.Series([60, 70, 65, 100, 230, 150, 100, 300, 250, 150])\n",
    "customers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "10c545ca-084b-490c-9f68-a751dc8e71e6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dtype('int64')"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "customers.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "1d6cff4a-a196-41b7-a150-141a22d86649",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 60,  70,  65, 100, 230, 150, 100, 300, 250, 150], dtype=int64)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "customers.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e1c3256e-7934-48ef-a12d-08c6bb69137a",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "e6157b85-84ac-4f54-ab8d-57f182609619",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1ec44b1ce00>]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGdCAYAAAA44ojeAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAABNvElEQVR4nO3deXhU5d3/8fdkm4SQBAJkIwGDAiJBRFAQEVA2aQGX1rVabam1FdDgUrfaQh8LLi2Kolh9fNyQ0l9bsVitCiggsohAhCAVlMgewhIyScie8/vjMEMCARIymXPmzOd1XblycuZk5jtiwof73Pf3dhmGYSAiIiJiI2FWFyAiIiJyPAUUERERsR0FFBEREbEdBRQRERGxHQUUERERsR0FFBEREbEdBRQRERGxHQUUERERsZ0Iqws4E7W1tezZs4e4uDhcLpfV5YiIiEgjGIZBcXExaWlphIWdeowkKAPKnj17yMjIsLoMEREROQM7d+4kPT39lNcEZUCJi4sDzDcYHx9vcTUiIiLSGB6Ph4yMDN/f46cSlAHFe1snPj5eAUVERCTINGZ6hibJioiIiO0ooIiIi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8fLxfn9uO9H6dTe/X2ULt/ULovWenvV/DMCguLiYtLe201/o9oOzatYubbrqJAwcO0KFDBwYMGMCqVavo3LkzAL/5zW8oKyvjrrvuorCwkP79+/Pxxx8TFxfX6NcICwsjPT3d36XXEx8f74j/GRpL79fZ9H6dLdTeL4Tee3bS+z3dyImX3wPKvHnzTvm4y+ViypQpTJkyxd8vLSIiIg6hvXhERETEdhRQjuN2u/n9739fb9WQk+n9Opver7OF2vuF0HvPofZ+63IZjVnrIyIiIhJAGkERERER21FAEREREdtRQBERERHbUUARERER21FAOWr37t3ccssttGvXjlatWnHBBRewdu1aq8tqMdXV1fz2t78lMzOTmJgYunTpwh/+8Adqa2utLs0vli1bxtixY0lLS8PlcvHuu+/We9wwDKZMmUJaWhoxMTEMHTqUTZs2WVOsH5zq/VZVVfHggw/Sq1cvYmNjSUtL46c//Sl79uyxruBmOt2fb1133nknLpeLZ599NmD1+Vtj3u/mzZsZN24cCQkJxMXFMWDAAHbs2BH4Yv3gdO+3pKSEiRMnkp6eTkxMDD169GD27NnWFOsH06dP56KLLiIuLo6kpCSuvvpqvvnmm3rXOO13VmMooACFhYVceumlREZG8p///Ievv/6aP//5z7Rp08bq0lrMk08+yUsvvcSsWbPYvHkzTz31FE8//TTPP/+81aX5RWlpKb1792bWrFkNPv7UU08xY8YMZs2axZo1a0hJSWHEiBG+fZ6Czane75EjR1i3bh2PPfYY69at45133mHLli2MGzfOgkr943R/vl7vvvsuq1evblRbbTs73fv97rvvGDRoEOeeey5Llizhq6++4rHHHiM6OjrAlfrH6d7v5MmT+fDDD5kzZw6bN29m8uTJTJo0iX/9618BrtQ/li5dyoQJE1i1ahULFy6kurqakSNHUlpa6rvGab+zGsUQ48EHHzQGDRpkdRkB9cMf/tD4+c9/Xu/ctddea9xyyy0WVdRyAGP+/Pm+r2tra42UlBTjiSee8J0rLy83EhISjJdeesmCCv3r+PfbkC+++MIAjO3btwemqBZ0sve7a9cuo2PHjkZubq7RuXNn45lnngl4bS2hofd7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lzoO1dZWcnSpUsZOHCghZW1HG842bp1K4sWLaJdu3ZWl9Ribr31VjZs2EBOTo7vIy0tjQceeICPPvrI6vL8LioqiosuuihkfodVVVVRVVXlqN9fhmEwceJE3nnnHT755BMyMzPrPR6Kv7NAt3gAc8nawIEDmTZtGtdffz1ffPEFL7/8Mi+//LLVpbWYsWPH8sc//pFOnTrRs2dP1q9fz4wZM/j5z39udWl+UVJSwrfffuv7Oi8vj5ycHBITE+nUqRPZ2dlMmzaNrl270rVrV6ZNm0arVq24+eabLaz6zJ3q/aalpfHjH/+YdevW8e9//5uamhrfv8QSExOJioqyquwzdro/3+MDWGRkJCkpKXTv3j3QpfrF6d7vAw88wA033MDgwYO5/PLL+fDDD3nvvfdYsmSJdUU3w+ne75AhQ3jggQeIiYmhc+fOLF26lDfffJMZM2ZYWPWZmzBhAnPnzuVf//oXcXFxvp/PhIQEYmJicLlcjvud1SiWriGykffee8/Iysoy3G63ce655xovv/yy1SW1KI/HY9xzzz1Gp06djOjoaKNLly7Go48+alRUVFhdml98+umnBnDCx2233WYYhrls7/e//72RkpJiuN1uY/DgwcbGjRutLboZTvV+8/LyGnwMMD799FOrSz8jp/vzPV6wLzNuzPt99dVXjXPOOceIjo42evfubbz77rvWFdxMp3u/e/fuNW6//XYjLS3NiI6ONrp37278+c9/Nmpra60t/Ayd7Ofztdde813jtN9ZjeEyDMNo0QQkIiIi0kSagyIiIiK2o4AiIiIitqOAIiIiIrajgCIiIiK2o4AiIiIitqOAIiIiIrajgCIiIiK2o4AiIiIitqOAIiIiIrajgCIiIiK2o4AiIiIitqOAIiIiIrbz/wHUGXqvV2jAswAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 绘制不同时段顾客人数的变化\n",
    "plt.plot(times, customers, '+')\n",
    "plt.plot(times, customers)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "fa23811a-d3e7-4115-aa73-a52a8edbed83",
   "metadata": {},
   "outputs": [],
   "source": [
    "from datetime import datetime   #"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "eeaea78f-82ff-4d5a-8c8e-17f8472ce356",
   "metadata": {},
   "outputs": [],
   "source": [
    "empty = pd.Series()#建立一个空的序列\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "8d1f9666-dc64-4d96-9408-56628702ad0c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6h      60\n",
       "7h      70\n",
       "8h      65\n",
       "11h    100\n",
       "12h    230\n",
       "13h    150\n",
       "18h    100\n",
       "19h    300\n",
       "20h    250\n",
       "21h    150\n",
       "dtype: int64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "times = ['6h', '7h', '8h', '11h', '12h', '13h', '18h', '19h', '20h', '21h']\n",
    "customers = pd.Series([60, 70, 65, 100, 230, 150, 100, 300, 250, 150], index=times)\n",
    "customers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "03f3e5c5-88e0-48e4-8be1-bf559a20d646",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "70"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "customers.iloc[1] #不用索引，用序号提取数据"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c5535609-4899-4c80-a9d0-0effff622adb",
   "metadata": {},
   "source": [
    "## DataFrame数据类型：多个Series加在一起"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "1d6e776d-3df4-4e20-a609-feeb8ab28a73",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 时段4点，5点，... 22点\n",
    "times = np.array([6, 7, 8, 11, 12, 13, 18, 19, 20, 21])\n",
    "# 顾客人数\n",
    "customers = np.array([60, 70, 65, 100, 230, 150, 100, 300, 250, 150])\n",
    "# 平均消费\n",
    "costs = np.array([6, 7, 8, 24, 23, 26, 45, 55, 45, 40])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "53db57d2-cf0c-4028-98f8-c77c9b366b96",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customers</th>\n",
       "      <th>costs</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>60</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>70</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>65</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>100</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>230</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>150</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>100</td>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>300</td>\n",
       "      <td>55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>250</td>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>150</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    customers  costs\n",
       "6          60      6\n",
       "7          70      7\n",
       "8          65      8\n",
       "11        100     24\n",
       "12        230     23\n",
       "13        150     26\n",
       "18        100     45\n",
       "19        300     55\n",
       "20        250     45\n",
       "21        150     40"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#画出一个表格，每一列都是array，索引使用time的array\n",
    "data = {'customers': customers, 'costs': costs}\n",
    "df = pd.DataFrame(data, index=times)\n",
    "df "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "5d45d5f8-0ad6-4d90-b36f-14bb38283ff3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6      6\n",
       "7      7\n",
       "8      8\n",
       "11    24\n",
       "12    23\n",
       "13    26\n",
       "18    45\n",
       "19    55\n",
       "20    45\n",
       "21    40\n",
       "Name: costs, dtype: int32"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['costs'] #找出costs这一列和它的索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "217bb0ac-863d-47c7-b926-f3d4ba50b7c1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "23"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['costs'][12] #找出costs的"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2a472d22-6c5f-4844-a1d8-9971fd88076e",
   "metadata": {},
   "source": [
    "生成40个同学的语文成绩，满分150，平局80分，标准差为20分。请用随机数生成40个分数，要求为整数\n",
    "数学： 60+-30\n",
    "英语： 70+-20\n",
    "物理： 80+-10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "c032a4da-abd2-4215-a080-7b21bdece063",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[115.  88. 100. 125. 117.  60.  99.  77.  78.  88.  83. 109.  95.  82.\n",
      "  89.  87. 110.  76.  86.  63.  29.  93.  97.  65. 125.  51.  81.  76.\n",
      " 111. 109.  83.  88.  62.  40.  73.  83. 105. 104.  72.  74.]\n"
     ]
    }
   ],
   "source": [
    "\n",
    "import numpy as np\n",
    "\n",
    "# 设置随机数生成的种子，确保每次运行结果一致\n",
    "np.random.seed(0)\n",
    "\n",
    "# 生成40个同学的语文成绩\n",
    "# loc=80 是平均分，scale=20 是标准差\n",
    "scores = np.random.normal(loc=80, scale=20, size=40)\n",
    "\n",
    "# 将生成的浮点数四舍五入到最近的整数\n",
    "scores_rounded = np.rint(scores)\n",
    "\n",
    "# 确保分数在0到150之间\n",
    "scores_rounded = np.clip(scores_rounded, 0, 150)\n",
    "\n",
    "# 打印生成的成绩\n",
    "print(scores_rounded)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "64cf213b-02c7-43c6-be5b-fc74b7b95b5d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 59,  51,  45, 119,  69,  71,  54,  95,  47,  75,  62,  87,  69,\n",
       "        56,  79,  88,  81,  86,  67,  72,  66,  72,  63,  45,  83,  71,\n",
       "        47,  89,  61,  81,  94,  82, 102,  55,  88,  66,  62,  68,  73,\n",
       "        81])"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "\n",
    "chinese = np.random.normal(80, 20, 40).astype(np.int32)\n",
    "chinese"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "5a5b0477-574e-45a0-b58d-e98e90c243f3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 75,  99,  89,  80,  67,  88,  69,  64,  91,  83,  89,  83,  88,\n",
       "        73,  69,  86,  71,  73,  75,  80,  76,  66,  73,  57,  86,  63,\n",
       "        68,  80,  72,  95,  67,  82,  79,  68,  85,  78,  87,  88, 101,\n",
       "        93])"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math = np.random.normal(60, 30, 40).astype(np.int32)\n",
    "english = np.random.normal(70, 20, 40).astype(np.int32)\n",
    "physics = np.random.normal(80, 10, 40).astype(np.int32)\n",
    "math\n",
    "english\n",
    "physics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "c714be31-b67f-42c9-9144-0e846969e046",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,\n",
       "       18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,\n",
       "       35, 36, 37, 38, 39, 40])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "students = np.array([ i+1 for i in range(40)])\n",
    "students"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "3cb39da0-ad2b-4e52-8509-2df3a2066cac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Chinese</th>\n",
       "      <th>Math</th>\n",
       "      <th>Physics</th>\n",
       "      <th>English</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>59</td>\n",
       "      <td>25</td>\n",
       "      <td>75</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>51</td>\n",
       "      <td>87</td>\n",
       "      <td>99</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>45</td>\n",
       "      <td>73</td>\n",
       "      <td>89</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>119</td>\n",
       "      <td>13</td>\n",
       "      <td>80</td>\n",
       "      <td>96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>69</td>\n",
       "      <td>104</td>\n",
       "      <td>67</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>71</td>\n",
       "      <td>116</td>\n",
       "      <td>88</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>54</td>\n",
       "      <td>95</td>\n",
       "      <td>69</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>95</td>\n",
       "      <td>54</td>\n",
       "      <td>64</td>\n",
       "      <td>106</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>47</td>\n",
       "      <td>27</td>\n",
       "      <td>91</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>75</td>\n",
       "      <td>91</td>\n",
       "      <td>83</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>62</td>\n",
       "      <td>47</td>\n",
       "      <td>89</td>\n",
       "      <td>54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>87</td>\n",
       "      <td>96</td>\n",
       "      <td>83</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>69</td>\n",
       "      <td>66</td>\n",
       "      <td>88</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>56</td>\n",
       "      <td>89</td>\n",
       "      <td>73</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>79</td>\n",
       "      <td>70</td>\n",
       "      <td>69</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>88</td>\n",
       "      <td>81</td>\n",
       "      <td>86</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>81</td>\n",
       "      <td>60</td>\n",
       "      <td>71</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>86</td>\n",
       "      <td>113</td>\n",
       "      <td>73</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>67</td>\n",
       "      <td>63</td>\n",
       "      <td>75</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>72</td>\n",
       "      <td>72</td>\n",
       "      <td>80</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>66</td>\n",
       "      <td>116</td>\n",
       "      <td>76</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>72</td>\n",
       "      <td>19</td>\n",
       "      <td>66</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>63</td>\n",
       "      <td>21</td>\n",
       "      <td>73</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>45</td>\n",
       "      <td>89</td>\n",
       "      <td>57</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>83</td>\n",
       "      <td>24</td>\n",
       "      <td>86</td>\n",
       "      <td>117</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>71</td>\n",
       "      <td>118</td>\n",
       "      <td>63</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>47</td>\n",
       "      <td>47</td>\n",
       "      <td>68</td>\n",
       "      <td>51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>89</td>\n",
       "      <td>37</td>\n",
       "      <td>80</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>61</td>\n",
       "      <td>117</td>\n",
       "      <td>72</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>81</td>\n",
       "      <td>104</td>\n",
       "      <td>95</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>94</td>\n",
       "      <td>116</td>\n",
       "      <td>67</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>82</td>\n",
       "      <td>87</td>\n",
       "      <td>82</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>102</td>\n",
       "      <td>34</td>\n",
       "      <td>79</td>\n",
       "      <td>55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>55</td>\n",
       "      <td>117</td>\n",
       "      <td>68</td>\n",
       "      <td>53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>88</td>\n",
       "      <td>51</td>\n",
       "      <td>85</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>66</td>\n",
       "      <td>84</td>\n",
       "      <td>78</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>62</td>\n",
       "      <td>88</td>\n",
       "      <td>87</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>68</td>\n",
       "      <td>55</td>\n",
       "      <td>88</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>73</td>\n",
       "      <td>78</td>\n",
       "      <td>101</td>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>81</td>\n",
       "      <td>87</td>\n",
       "      <td>93</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Chinese  Math  Physics  English\n",
       "1        59    25       75       77\n",
       "2        51    87       99       48\n",
       "3        45    73       89       75\n",
       "4       119    13       80       96\n",
       "5        69   104       67       56\n",
       "6        71   116       88       67\n",
       "7        54    95       69       61\n",
       "8        95    54       64      106\n",
       "9        47    27       91       83\n",
       "10       75    91       83       78\n",
       "11       62    47       89       54\n",
       "12       87    96       83       80\n",
       "13       69    66       88       56\n",
       "14       56    89       73       70\n",
       "15       79    70       69       57\n",
       "16       88    81       86       83\n",
       "17       81    60       71       81\n",
       "18       86   113       73       65\n",
       "19       67    63       75       77\n",
       "20       72    72       80       48\n",
       "21       66   116       76       40\n",
       "22       72    19       66       78\n",
       "23       63    21       73       73\n",
       "24       45    89       57       82\n",
       "25       83    24       86      117\n",
       "26       71   118       63       88\n",
       "27       47    47       68       51\n",
       "28       89    37       80       92\n",
       "29       61   117       72       43\n",
       "30       81   104       95       60\n",
       "31       94   116       67       68\n",
       "32       82    87       82      104\n",
       "33      102    34       79       55\n",
       "34       55   117       68       53\n",
       "35       88    51       85       68\n",
       "36       66    84       78       56\n",
       "37       62    88       87       92\n",
       "38       68    55       88       48\n",
       "39       73    78      101       47\n",
       "40       81    87       93       61"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = {'Chinese': chinese, 'Math': math, 'Physics': physics, 'English':english}\n",
    "df = pd.DataFrame(data, index=students)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "eb89257b-6547-4492-baf9-b1ad4140b39b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([32219100001, 32219100002, 32219100003, 32219100004, 32219100005,\n",
       "       32219100006, 32219100007, 32219100008, 32219100009, 32219100010,\n",
       "       32219100011, 32219100012, 32219100013, 32219100014, 32219100015,\n",
       "       32219100016, 32219100017, 32219100018, 32219100019, 32219100020,\n",
       "       32219100021, 32219100022, 32219100023, 32219100024, 32219100025,\n",
       "       32219100026, 32219100027, 32219100028, 32219100029, 32219100030,\n",
       "       32219100031, 32219100032, 32219100033, 32219100034, 32219100035,\n",
       "       32219100036, 32219100037, 32219100038, 32219100039, 32219100040],\n",
       "      dtype=int64)"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "studentid = np.array([ i+32219100001 for i in range(40)])\n",
    "studentid"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "7b111ae3-15e7-46d5-967b-b1423d69adc3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Chinese</th>\n",
       "      <th>Math</th>\n",
       "      <th>Physics</th>\n",
       "      <th>English</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>32219100001</th>\n",
       "      <td>59</td>\n",
       "      <td>25</td>\n",
       "      <td>75</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100002</th>\n",
       "      <td>51</td>\n",
       "      <td>87</td>\n",
       "      <td>99</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100003</th>\n",
       "      <td>45</td>\n",
       "      <td>73</td>\n",
       "      <td>89</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100004</th>\n",
       "      <td>119</td>\n",
       "      <td>13</td>\n",
       "      <td>80</td>\n",
       "      <td>96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100005</th>\n",
       "      <td>69</td>\n",
       "      <td>104</td>\n",
       "      <td>67</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100006</th>\n",
       "      <td>71</td>\n",
       "      <td>116</td>\n",
       "      <td>88</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100007</th>\n",
       "      <td>54</td>\n",
       "      <td>95</td>\n",
       "      <td>69</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100008</th>\n",
       "      <td>95</td>\n",
       "      <td>54</td>\n",
       "      <td>64</td>\n",
       "      <td>106</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100009</th>\n",
       "      <td>47</td>\n",
       "      <td>27</td>\n",
       "      <td>91</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100010</th>\n",
       "      <td>75</td>\n",
       "      <td>91</td>\n",
       "      <td>83</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100011</th>\n",
       "      <td>62</td>\n",
       "      <td>47</td>\n",
       "      <td>89</td>\n",
       "      <td>54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100012</th>\n",
       "      <td>87</td>\n",
       "      <td>96</td>\n",
       "      <td>83</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100013</th>\n",
       "      <td>69</td>\n",
       "      <td>66</td>\n",
       "      <td>88</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100014</th>\n",
       "      <td>56</td>\n",
       "      <td>89</td>\n",
       "      <td>73</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100015</th>\n",
       "      <td>79</td>\n",
       "      <td>70</td>\n",
       "      <td>69</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100016</th>\n",
       "      <td>88</td>\n",
       "      <td>81</td>\n",
       "      <td>86</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100017</th>\n",
       "      <td>81</td>\n",
       "      <td>60</td>\n",
       "      <td>71</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100018</th>\n",
       "      <td>86</td>\n",
       "      <td>113</td>\n",
       "      <td>73</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100019</th>\n",
       "      <td>67</td>\n",
       "      <td>63</td>\n",
       "      <td>75</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100020</th>\n",
       "      <td>72</td>\n",
       "      <td>72</td>\n",
       "      <td>80</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100021</th>\n",
       "      <td>66</td>\n",
       "      <td>116</td>\n",
       "      <td>76</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100022</th>\n",
       "      <td>72</td>\n",
       "      <td>19</td>\n",
       "      <td>66</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100023</th>\n",
       "      <td>63</td>\n",
       "      <td>21</td>\n",
       "      <td>73</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100024</th>\n",
       "      <td>45</td>\n",
       "      <td>89</td>\n",
       "      <td>57</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100025</th>\n",
       "      <td>83</td>\n",
       "      <td>24</td>\n",
       "      <td>86</td>\n",
       "      <td>117</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100026</th>\n",
       "      <td>71</td>\n",
       "      <td>118</td>\n",
       "      <td>63</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100027</th>\n",
       "      <td>47</td>\n",
       "      <td>47</td>\n",
       "      <td>68</td>\n",
       "      <td>51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100028</th>\n",
       "      <td>89</td>\n",
       "      <td>37</td>\n",
       "      <td>80</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100029</th>\n",
       "      <td>61</td>\n",
       "      <td>117</td>\n",
       "      <td>72</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100030</th>\n",
       "      <td>81</td>\n",
       "      <td>104</td>\n",
       "      <td>95</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100031</th>\n",
       "      <td>94</td>\n",
       "      <td>116</td>\n",
       "      <td>67</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100032</th>\n",
       "      <td>82</td>\n",
       "      <td>87</td>\n",
       "      <td>82</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100033</th>\n",
       "      <td>102</td>\n",
       "      <td>34</td>\n",
       "      <td>79</td>\n",
       "      <td>55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100034</th>\n",
       "      <td>55</td>\n",
       "      <td>117</td>\n",
       "      <td>68</td>\n",
       "      <td>53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100035</th>\n",
       "      <td>88</td>\n",
       "      <td>51</td>\n",
       "      <td>85</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100036</th>\n",
       "      <td>66</td>\n",
       "      <td>84</td>\n",
       "      <td>78</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100037</th>\n",
       "      <td>62</td>\n",
       "      <td>88</td>\n",
       "      <td>87</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100038</th>\n",
       "      <td>68</td>\n",
       "      <td>55</td>\n",
       "      <td>88</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100039</th>\n",
       "      <td>73</td>\n",
       "      <td>78</td>\n",
       "      <td>101</td>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100040</th>\n",
       "      <td>81</td>\n",
       "      <td>87</td>\n",
       "      <td>93</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Chinese  Math  Physics  English\n",
       "32219100001       59    25       75       77\n",
       "32219100002       51    87       99       48\n",
       "32219100003       45    73       89       75\n",
       "32219100004      119    13       80       96\n",
       "32219100005       69   104       67       56\n",
       "32219100006       71   116       88       67\n",
       "32219100007       54    95       69       61\n",
       "32219100008       95    54       64      106\n",
       "32219100009       47    27       91       83\n",
       "32219100010       75    91       83       78\n",
       "32219100011       62    47       89       54\n",
       "32219100012       87    96       83       80\n",
       "32219100013       69    66       88       56\n",
       "32219100014       56    89       73       70\n",
       "32219100015       79    70       69       57\n",
       "32219100016       88    81       86       83\n",
       "32219100017       81    60       71       81\n",
       "32219100018       86   113       73       65\n",
       "32219100019       67    63       75       77\n",
       "32219100020       72    72       80       48\n",
       "32219100021       66   116       76       40\n",
       "32219100022       72    19       66       78\n",
       "32219100023       63    21       73       73\n",
       "32219100024       45    89       57       82\n",
       "32219100025       83    24       86      117\n",
       "32219100026       71   118       63       88\n",
       "32219100027       47    47       68       51\n",
       "32219100028       89    37       80       92\n",
       "32219100029       61   117       72       43\n",
       "32219100030       81   104       95       60\n",
       "32219100031       94   116       67       68\n",
       "32219100032       82    87       82      104\n",
       "32219100033      102    34       79       55\n",
       "32219100034       55   117       68       53\n",
       "32219100035       88    51       85       68\n",
       "32219100036       66    84       78       56\n",
       "32219100037       62    88       87       92\n",
       "32219100038       68    55       88       48\n",
       "32219100039       73    78      101       47\n",
       "32219100040       81    87       93       61"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = {'Chinese': chinese, 'Math': math, 'Physics': physics, 'English':english}\n",
    "df = pd.DataFrame(data, index=studentid)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "f6a4d2ea-a782-4216-b9d2-cc2467293ec3",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_csv('mark.csv') #生成一个csv文件"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "35a816db-ec8b-414d-a033-c446fd6da361",
   "metadata": {},
   "source": [
    "Pandas 提供了如下方法来选取数据：\n",
    "\n",
    "df[col]：返回指定列\n",
    "df[[col1, col2]]：返回指定多列\n",
    "s.loc['index_one']：按索引选取数据\n",
    "s.iloc[0]：按位置选取数据\n",
    "df.iloc[0,:]：返回第1行\n",
    "df.iloc[0,0]：返回第1列的第1个元素"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "e060d4d4-17fa-4aaa-8eba-c0ca37cf66cf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Math</th>\n",
       "      <th>Physics</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>32219100001</th>\n",
       "      <td>25</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100002</th>\n",
       "      <td>87</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100003</th>\n",
       "      <td>73</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100004</th>\n",
       "      <td>13</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100005</th>\n",
       "      <td>104</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100006</th>\n",
       "      <td>116</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100007</th>\n",
       "      <td>95</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100008</th>\n",
       "      <td>54</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100009</th>\n",
       "      <td>27</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100010</th>\n",
       "      <td>91</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100011</th>\n",
       "      <td>47</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100012</th>\n",
       "      <td>96</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100013</th>\n",
       "      <td>66</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100014</th>\n",
       "      <td>89</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100015</th>\n",
       "      <td>70</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100016</th>\n",
       "      <td>81</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100017</th>\n",
       "      <td>60</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100018</th>\n",
       "      <td>113</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100019</th>\n",
       "      <td>63</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100020</th>\n",
       "      <td>72</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100021</th>\n",
       "      <td>116</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100022</th>\n",
       "      <td>19</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100023</th>\n",
       "      <td>21</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100024</th>\n",
       "      <td>89</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100025</th>\n",
       "      <td>24</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100026</th>\n",
       "      <td>118</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100027</th>\n",
       "      <td>47</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100028</th>\n",
       "      <td>37</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100029</th>\n",
       "      <td>117</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100030</th>\n",
       "      <td>104</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100031</th>\n",
       "      <td>116</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100032</th>\n",
       "      <td>87</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100033</th>\n",
       "      <td>34</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100034</th>\n",
       "      <td>117</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100035</th>\n",
       "      <td>51</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100036</th>\n",
       "      <td>84</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100037</th>\n",
       "      <td>88</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100038</th>\n",
       "      <td>55</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100039</th>\n",
       "      <td>78</td>\n",
       "      <td>101</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100040</th>\n",
       "      <td>87</td>\n",
       "      <td>93</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Math  Physics\n",
       "32219100001    25       75\n",
       "32219100002    87       99\n",
       "32219100003    73       89\n",
       "32219100004    13       80\n",
       "32219100005   104       67\n",
       "32219100006   116       88\n",
       "32219100007    95       69\n",
       "32219100008    54       64\n",
       "32219100009    27       91\n",
       "32219100010    91       83\n",
       "32219100011    47       89\n",
       "32219100012    96       83\n",
       "32219100013    66       88\n",
       "32219100014    89       73\n",
       "32219100015    70       69\n",
       "32219100016    81       86\n",
       "32219100017    60       71\n",
       "32219100018   113       73\n",
       "32219100019    63       75\n",
       "32219100020    72       80\n",
       "32219100021   116       76\n",
       "32219100022    19       66\n",
       "32219100023    21       73\n",
       "32219100024    89       57\n",
       "32219100025    24       86\n",
       "32219100026   118       63\n",
       "32219100027    47       68\n",
       "32219100028    37       80\n",
       "32219100029   117       72\n",
       "32219100030   104       95\n",
       "32219100031   116       67\n",
       "32219100032    87       82\n",
       "32219100033    34       79\n",
       "32219100034   117       68\n",
       "32219100035    51       85\n",
       "32219100036    84       78\n",
       "32219100037    88       87\n",
       "32219100038    55       88\n",
       "32219100039    78      101\n",
       "32219100040    87       93"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[['Math', 'Physics']] #记得加俩个括号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "ebd17ea0-6a81-467a-912a-6e0351b535ba",
   "metadata": {},
   "outputs": [
    {
     "ename": "FileNotFoundError",
     "evalue": "[Errno 2] No such file or directory: 'demo01.csv'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mFileNotFoundError\u001b[0m                         Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[36], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdemo01.csv\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m      2\u001b[0m df\u001b[38;5;241m.\u001b[39minfo()\n",
      "File \u001b[1;32mf:\\anaconda3\\Lib\\site-packages\\pandas\\io\\parsers\\readers.py:1026\u001b[0m, in \u001b[0;36mread_csv\u001b[1;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)\u001b[0m\n\u001b[0;32m   1013\u001b[0m kwds_defaults \u001b[38;5;241m=\u001b[39m _refine_defaults_read(\n\u001b[0;32m   1014\u001b[0m     dialect,\n\u001b[0;32m   1015\u001b[0m     delimiter,\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m   1022\u001b[0m     dtype_backend\u001b[38;5;241m=\u001b[39mdtype_backend,\n\u001b[0;32m   1023\u001b[0m )\n\u001b[0;32m   1024\u001b[0m kwds\u001b[38;5;241m.\u001b[39mupdate(kwds_defaults)\n\u001b[1;32m-> 1026\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _read(filepath_or_buffer, kwds)\n",
      "File \u001b[1;32mf:\\anaconda3\\Lib\\site-packages\\pandas\\io\\parsers\\readers.py:620\u001b[0m, in \u001b[0;36m_read\u001b[1;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[0;32m    617\u001b[0m _validate_names(kwds\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnames\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m))\n\u001b[0;32m    619\u001b[0m \u001b[38;5;66;03m# Create the parser.\u001b[39;00m\n\u001b[1;32m--> 620\u001b[0m parser \u001b[38;5;241m=\u001b[39m TextFileReader(filepath_or_buffer, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwds)\n\u001b[0;32m    622\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m chunksize \u001b[38;5;129;01mor\u001b[39;00m iterator:\n\u001b[0;32m    623\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m parser\n",
      "File \u001b[1;32mf:\\anaconda3\\Lib\\site-packages\\pandas\\io\\parsers\\readers.py:1620\u001b[0m, in \u001b[0;36mTextFileReader.__init__\u001b[1;34m(self, f, engine, **kwds)\u001b[0m\n\u001b[0;32m   1617\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptions[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhas_index_names\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m kwds[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhas_index_names\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m   1619\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandles: IOHandles \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m-> 1620\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_engine \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_make_engine(f, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine)\n",
      "File \u001b[1;32mf:\\anaconda3\\Lib\\site-packages\\pandas\\io\\parsers\\readers.py:1880\u001b[0m, in \u001b[0;36mTextFileReader._make_engine\u001b[1;34m(self, f, engine)\u001b[0m\n\u001b[0;32m   1878\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m mode:\n\u001b[0;32m   1879\u001b[0m         mode \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m-> 1880\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandles \u001b[38;5;241m=\u001b[39m get_handle(\n\u001b[0;32m   1881\u001b[0m     f,\n\u001b[0;32m   1882\u001b[0m     mode,\n\u001b[0;32m   1883\u001b[0m     encoding\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptions\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mencoding\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m),\n\u001b[0;32m   1884\u001b[0m     compression\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptions\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcompression\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m),\n\u001b[0;32m   1885\u001b[0m     memory_map\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptions\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmemory_map\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mFalse\u001b[39;00m),\n\u001b[0;32m   1886\u001b[0m     is_text\u001b[38;5;241m=\u001b[39mis_text,\n\u001b[0;32m   1887\u001b[0m     errors\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptions\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mencoding_errors\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstrict\u001b[39m\u001b[38;5;124m\"\u001b[39m),\n\u001b[0;32m   1888\u001b[0m     storage_options\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptions\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstorage_options\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m),\n\u001b[0;32m   1889\u001b[0m )\n\u001b[0;32m   1890\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandles \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m   1891\u001b[0m f \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandles\u001b[38;5;241m.\u001b[39mhandle\n",
      "File \u001b[1;32mf:\\anaconda3\\Lib\\site-packages\\pandas\\io\\common.py:873\u001b[0m, in \u001b[0;36mget_handle\u001b[1;34m(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)\u001b[0m\n\u001b[0;32m    868\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(handle, \u001b[38;5;28mstr\u001b[39m):\n\u001b[0;32m    869\u001b[0m     \u001b[38;5;66;03m# Check whether the filename is to be opened in binary mode.\u001b[39;00m\n\u001b[0;32m    870\u001b[0m     \u001b[38;5;66;03m# Binary mode does not support 'encoding' and 'newline'.\u001b[39;00m\n\u001b[0;32m    871\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m ioargs\u001b[38;5;241m.\u001b[39mencoding \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m ioargs\u001b[38;5;241m.\u001b[39mmode:\n\u001b[0;32m    872\u001b[0m         \u001b[38;5;66;03m# Encoding\u001b[39;00m\n\u001b[1;32m--> 873\u001b[0m         handle \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mopen\u001b[39m(\n\u001b[0;32m    874\u001b[0m             handle,\n\u001b[0;32m    875\u001b[0m             ioargs\u001b[38;5;241m.\u001b[39mmode,\n\u001b[0;32m    876\u001b[0m             encoding\u001b[38;5;241m=\u001b[39mioargs\u001b[38;5;241m.\u001b[39mencoding,\n\u001b[0;32m    877\u001b[0m             errors\u001b[38;5;241m=\u001b[39merrors,\n\u001b[0;32m    878\u001b[0m             newline\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m    879\u001b[0m         )\n\u001b[0;32m    880\u001b[0m     \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m    881\u001b[0m         \u001b[38;5;66;03m# Binary mode\u001b[39;00m\n\u001b[0;32m    882\u001b[0m         handle \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mopen\u001b[39m(handle, ioargs\u001b[38;5;241m.\u001b[39mmode)\n",
      "\u001b[1;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'demo01.csv'"
     ]
    }
   ],
   "source": [
    "df = pd.read_csv('demo01.csv')\n",
    "df.info()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "a09c2279-7bcf-4423-a793-af71225c6820",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Chinese    67\n",
       "Math       63\n",
       "Physics    75\n",
       "English    77\n",
       "Name: 32219100019, dtype: int32"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.loc[32219100019] #提取出索引对应的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "e8c746bc-a16b-4591-89b9-4adfcd9fddd8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Chinese</th>\n",
       "      <th>Math</th>\n",
       "      <th>Physics</th>\n",
       "      <th>English</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>32219100005</th>\n",
       "      <td>69</td>\n",
       "      <td>104</td>\n",
       "      <td>67</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100006</th>\n",
       "      <td>71</td>\n",
       "      <td>116</td>\n",
       "      <td>88</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100007</th>\n",
       "      <td>54</td>\n",
       "      <td>95</td>\n",
       "      <td>69</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100010</th>\n",
       "      <td>75</td>\n",
       "      <td>91</td>\n",
       "      <td>83</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100012</th>\n",
       "      <td>87</td>\n",
       "      <td>96</td>\n",
       "      <td>83</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100018</th>\n",
       "      <td>86</td>\n",
       "      <td>113</td>\n",
       "      <td>73</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100021</th>\n",
       "      <td>66</td>\n",
       "      <td>116</td>\n",
       "      <td>76</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100026</th>\n",
       "      <td>71</td>\n",
       "      <td>118</td>\n",
       "      <td>63</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100029</th>\n",
       "      <td>61</td>\n",
       "      <td>117</td>\n",
       "      <td>72</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100030</th>\n",
       "      <td>81</td>\n",
       "      <td>104</td>\n",
       "      <td>95</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100031</th>\n",
       "      <td>94</td>\n",
       "      <td>116</td>\n",
       "      <td>67</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100034</th>\n",
       "      <td>55</td>\n",
       "      <td>117</td>\n",
       "      <td>68</td>\n",
       "      <td>53</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Chinese  Math  Physics  English\n",
       "32219100005       69   104       67       56\n",
       "32219100006       71   116       88       67\n",
       "32219100007       54    95       69       61\n",
       "32219100010       75    91       83       78\n",
       "32219100012       87    96       83       80\n",
       "32219100018       86   113       73       65\n",
       "32219100021       66   116       76       40\n",
       "32219100026       71   118       63       88\n",
       "32219100029       61   117       72       43\n",
       "32219100030       81   104       95       60\n",
       "32219100031       94   116       67       68\n",
       "32219100034       55   117       68       53"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df [ df['Math']>= 90] #找出数学不及格的同学"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "1148a14c-35b0-41ec-810d-f064172592a2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Chinese</th>\n",
       "      <th>Math</th>\n",
       "      <th>Physics</th>\n",
       "      <th>English</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>32219100002</th>\n",
       "      <td>51</td>\n",
       "      <td>87</td>\n",
       "      <td>99</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100003</th>\n",
       "      <td>45</td>\n",
       "      <td>73</td>\n",
       "      <td>89</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100005</th>\n",
       "      <td>69</td>\n",
       "      <td>104</td>\n",
       "      <td>67</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100006</th>\n",
       "      <td>71</td>\n",
       "      <td>116</td>\n",
       "      <td>88</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100007</th>\n",
       "      <td>54</td>\n",
       "      <td>95</td>\n",
       "      <td>69</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100008</th>\n",
       "      <td>95</td>\n",
       "      <td>54</td>\n",
       "      <td>64</td>\n",
       "      <td>106</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100010</th>\n",
       "      <td>75</td>\n",
       "      <td>91</td>\n",
       "      <td>83</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100011</th>\n",
       "      <td>62</td>\n",
       "      <td>47</td>\n",
       "      <td>89</td>\n",
       "      <td>54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100012</th>\n",
       "      <td>87</td>\n",
       "      <td>96</td>\n",
       "      <td>83</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100013</th>\n",
       "      <td>69</td>\n",
       "      <td>66</td>\n",
       "      <td>88</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100014</th>\n",
       "      <td>56</td>\n",
       "      <td>89</td>\n",
       "      <td>73</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100015</th>\n",
       "      <td>79</td>\n",
       "      <td>70</td>\n",
       "      <td>69</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100016</th>\n",
       "      <td>88</td>\n",
       "      <td>81</td>\n",
       "      <td>86</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100017</th>\n",
       "      <td>81</td>\n",
       "      <td>60</td>\n",
       "      <td>71</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100018</th>\n",
       "      <td>86</td>\n",
       "      <td>113</td>\n",
       "      <td>73</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100019</th>\n",
       "      <td>67</td>\n",
       "      <td>63</td>\n",
       "      <td>75</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100020</th>\n",
       "      <td>72</td>\n",
       "      <td>72</td>\n",
       "      <td>80</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100021</th>\n",
       "      <td>66</td>\n",
       "      <td>116</td>\n",
       "      <td>76</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100024</th>\n",
       "      <td>45</td>\n",
       "      <td>89</td>\n",
       "      <td>57</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100026</th>\n",
       "      <td>71</td>\n",
       "      <td>118</td>\n",
       "      <td>63</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100027</th>\n",
       "      <td>47</td>\n",
       "      <td>47</td>\n",
       "      <td>68</td>\n",
       "      <td>51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100029</th>\n",
       "      <td>61</td>\n",
       "      <td>117</td>\n",
       "      <td>72</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100030</th>\n",
       "      <td>81</td>\n",
       "      <td>104</td>\n",
       "      <td>95</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100031</th>\n",
       "      <td>94</td>\n",
       "      <td>116</td>\n",
       "      <td>67</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100032</th>\n",
       "      <td>82</td>\n",
       "      <td>87</td>\n",
       "      <td>82</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100034</th>\n",
       "      <td>55</td>\n",
       "      <td>117</td>\n",
       "      <td>68</td>\n",
       "      <td>53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100035</th>\n",
       "      <td>88</td>\n",
       "      <td>51</td>\n",
       "      <td>85</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100036</th>\n",
       "      <td>66</td>\n",
       "      <td>84</td>\n",
       "      <td>78</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100037</th>\n",
       "      <td>62</td>\n",
       "      <td>88</td>\n",
       "      <td>87</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100038</th>\n",
       "      <td>68</td>\n",
       "      <td>55</td>\n",
       "      <td>88</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100039</th>\n",
       "      <td>73</td>\n",
       "      <td>78</td>\n",
       "      <td>101</td>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100040</th>\n",
       "      <td>81</td>\n",
       "      <td>87</td>\n",
       "      <td>93</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Chinese  Math  Physics  English\n",
       "32219100002       51    87       99       48\n",
       "32219100003       45    73       89       75\n",
       "32219100005       69   104       67       56\n",
       "32219100006       71   116       88       67\n",
       "32219100007       54    95       69       61\n",
       "32219100008       95    54       64      106\n",
       "32219100010       75    91       83       78\n",
       "32219100011       62    47       89       54\n",
       "32219100012       87    96       83       80\n",
       "32219100013       69    66       88       56\n",
       "32219100014       56    89       73       70\n",
       "32219100015       79    70       69       57\n",
       "32219100016       88    81       86       83\n",
       "32219100017       81    60       71       81\n",
       "32219100018       86   113       73       65\n",
       "32219100019       67    63       75       77\n",
       "32219100020       72    72       80       48\n",
       "32219100021       66   116       76       40\n",
       "32219100024       45    89       57       82\n",
       "32219100026       71   118       63       88\n",
       "32219100027       47    47       68       51\n",
       "32219100029       61   117       72       43\n",
       "32219100030       81   104       95       60\n",
       "32219100031       94   116       67       68\n",
       "32219100032       82    87       82      104\n",
       "32219100034       55   117       68       53\n",
       "32219100035       88    51       85       68\n",
       "32219100036       66    84       78       56\n",
       "32219100037       62    88       87       92\n",
       "32219100038       68    55       88       48\n",
       "32219100039       73    78      101       47\n",
       "32219100040       81    87       93       61"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[(df['Math']>=40)&(df['Chinese']>=40)&(df['English'] >=40)&(df['Physics'] >=40)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "3f202b59-dc3c-4992-84b7-8086f0939635",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 78,  90,  73,  95,  82,  86,  69,  92,  86,  93,  73,  75, 103,\n",
       "        69,  78,  91,  80,  85,  76,  83,  66,  96,  78,  73,  86,  75,\n",
       "        66,  66,  86,  78,  78,  90,  68,  72,  76,  80,  79,  77,  79,\n",
       "        78])"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math = np.random.normal(60, 30, 40).astype(np.int32)\n",
    "english = np.random.normal(70, 20, 40).astype(np.int32)\n",
    "physics = np.random.normal(80, 10, 40).astype(np.int32)\n",
    "\n",
    "english\n",
    "physics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "e07d5954-5555-4daa-866b-cd6cac956063",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([242, 255, 277, 357, 293, 204, 275, 315, 254, 265, 302, 289, 327,\n",
       "       234, 271, 309, 275, 284, 308, 295, 209, 276, 245, 260, 213, 280,\n",
       "       257, 292, 252, 282, 266, 231, 322, 276, 245, 291, 324, 210, 253,\n",
       "       350])"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#算总分\n",
    "total_score = np.array( math + english + physics + chinese)\n",
    "total_score"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "95c5c4c2-7e32-430f-ae27-eaabd184e649",
   "metadata": {},
   "source": [
    "## 作业"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "75cb26c3-da19-439a-9515-7146ac3c8c97",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Chinese 成绩分析:\n",
      "及格率: 68.29268292682927%\n",
      "分数段分布:\n",
      "English\n",
      "80+      39.024390\n",
      "<60      31.707317\n",
      "60-80    29.268293\n",
      "Name: proportion, dtype: float64\n",
      "\n",
      "Math 成绩分析:\n",
      "及格率: 68.29268292682927%\n",
      "分数段分布:\n",
      "English\n",
      "80+      39.024390\n",
      "<60      31.707317\n",
      "60-80    29.268293\n",
      "Name: proportion, dtype: float64\n",
      "\n",
      "Physics 成绩分析:\n",
      "及格率: 68.29268292682927%\n",
      "分数段分布:\n",
      "English\n",
      "80+      39.024390\n",
      "<60      31.707317\n",
      "60-80    29.268293\n",
      "Name: proportion, dtype: float64\n",
      "\n",
      "English 成绩分析:\n",
      "及格率: 68.29268292682927%\n",
      "分数段分布:\n",
      "English\n",
      "80+      39.024390\n",
      "<60      31.707317\n",
      "60-80    29.268293\n",
      "Name: proportion, dtype: float64\n",
      "\n",
      "总成绩分析:\n",
      "及格率: 85.37%\n",
      "分数段分布:\n",
      "Total_score\n",
      "60-80    58.536585\n",
      "80+      26.829268\n",
      "<60      14.634146\n",
      "Name: proportion, dtype: float64\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "\n",
    "chinese = np.random.normal(80, 20, 40).astype(np.int32)     #生成成绩，np.random.normal(平均值，标准差，多少个）\n",
    "                                                            #astype(np.int32)表示把前面的数字变成整数\n",
    "math = np.random.normal(60, 30, 40).astype(np.int32)\n",
    "english = np.random.normal(70, 20, 40).astype(np.int32)\n",
    "physics = np.random.normal(80, 10, 40).astype(np.int32)\n",
    "total_score = np.array( math + english + physics + chinese) #四者相加可以得到总成绩\n",
    "studentid = np.array([ i+32219100001 for i in range(40)])   #用for循环生成学号的array\n",
    "\n",
    "\n",
    "average = np.array( total_score/4)                          #有四门课，总分出一丝可以得到平均成绩\n",
    "\n",
    "data = {'Chinese': chinese, 'Math': math, 'Physics': physics, 'English':english, 'Total_score':total_score,'Average':average}\n",
    "                                                            #把每一列array和它的标题整合在一个字典里面\n",
    "df = pd.DataFrame(data, index=studentid)                    #生成DF表格，以学号为索引，成绩作为数据\n",
    "                            \n",
    "\n",
    "df = df.sort_values(by='Total_score', ascending=False)      #df.sort_values可以根据某个值对DF表格进行排序\n",
    "                                                            #by = 'Total_score'表示以我们的总成绩为依据\n",
    "                                                            #ascending=False表示按照降序排序\n",
    "                                                            #计算各科的平均分\n",
    "df.loc['Average'] = df.mean() \n",
    "                                                            #创建一个新的索引叫Average并且用df.mean()对上面的数据球平均\n",
    "                                                            #把新的一行加入到文件里面\n",
    "df.to_csv('mark.csv')  \n",
    "                                                            #统计分数\n",
    "def calculate(df, subject):                                 #定义一个统计分数的函数\n",
    "    pass_count = (df[subject] >= 60).sum()                  #创建一个布尔数组，通过人数是大于60分的人的数量累加\n",
    "                                                            #通过.sum可以实现快速累加\n",
    "    pass_rate = pass_count / len(df) * 100                  #len(df)表示行的数量\n",
    "    #利用apply对成绩进行分组：其中用lamba定义了一个变量，写出<60如果分数x小于60.。。。\n",
    "    #这样就会生成三个分数段的序列\n",
    "\n",
    "    score_distribution = df[subject].apply(lambda x: '<60' if x < 60 else '60-80' if 60 <= x < 80 else '80+')\n",
    "                                                        \n",
    "    #用.value_counts统计每一个分数段出现的次数，用normalize=True把结果转化成小数，再*100\n",
    "    score_counts = score_distribution.value_counts(normalize=True)*100\n",
    "    \n",
    "    return pass_rate, score_counts                          #最后然函数返回及格率和分数段统计两个数据\n",
    " \n",
    "\n",
    "for subject in ['Chinese', 'Math', 'Physics', 'English']:   #用for循环依次将各科成绩代入函数\n",
    "    calculate(df, subject)                                  #使用函数\n",
    "    print(f\"\\n{subject} 成绩分析:\")                          #写出 成绩分析，注意空行不然不好看\n",
    "    print(f\"及格率: {pass_rate:}%\")                          #写出及格率\n",
    "    print(\"分数段分布:\")                                     #写出分数段分布\n",
    "    print(score_distribution)\n",
    "\n",
    "# 计算总成绩的及格率和分数段人数\n",
    "total_pass_count = (df['Total_score'] >= 60 * 4).sum()      #总成绩大于240的都是及格的\n",
    "total_pass_rate = total_pass_count / len(df) * 100          \n",
    "                                                            \n",
    "total_score_distribution = df['Total_score'].apply(lambda x: '<60' if x < 60 * 4 else '60-80' if 60 * 4 <= x < 80 * 4 else '80+')\n",
    "total_score_counts = total_score_distribution.value_counts(normalize=True) * 100\n",
    "print(f\"\\n总成绩分析:\")\n",
    "print(f\"及格率: {total_pass_rate:.2f}%\")\n",
    "print(\"分数段分布:\")\n",
    "print(total_score_counts)\n",
    "\n",
    "\n",
    "\n",
    "df\n",
    "df.to_csv('mark.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "59eecd51-7cc0-49ac-972d-c9836ccc81b4",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "75b6d684-5aa9-4b02-8f40-f0af7644a781",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "25d649a4-27ec-4ba7-aff7-20cb1479e1fe",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e07ac57d-4868-44df-af6d-7c2717375cf3",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
